import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'

import './permission' // permission control

// 第三方工具
import Cookies from 'js-cookie'

// 第三方 UI
import Element from 'element-ui'
import './assets/styles/element-variables.scss'

// styled
import '@/assets/styles/index.scss' // global css
import '@/assets/styles/ruoyi.scss' // public css

// 自定义公共方法
import {
  parseTime,
  getSystemTime,
  selectDictLabel,
  selectDictLabels,
  publicActionSessionStorage,
} from './shared/index'

import i18n from '../public/static/lang'

// parseTime
Vue.prototype.parseTime = parseTime
Vue.prototype.getSystemTime = getSystemTime
Vue.prototype.selectDictLabel = selectDictLabel
Vue.prototype.selectDictLabels = selectDictLabels
Vue.prototype.publicActionSessionStorage = publicActionSessionStorage

Vue.prototype.msgSuccess = function(msg: string) {
  this.$message({ showClose: true, message: msg, type: 'success' })
}
Vue.prototype.msgError = function(msg: any) {
  this.$message({ showClose: true, message: msg, type: 'error' })
}
Vue.prototype.msgInfo = function(msg: any) {
  this.$message.info(msg)
}

// Element settings
// @ts-ignore
Element.Dialog.props.closeOnClickModal = false

// mount
Vue.use(Element, {
  size: Cookies.get('size') || 'medium'
})

Vue.config.productionTip = false

new Vue({
  router,
  store,
  i18n,
  render: h => h(App)
}).$mount('#app')
